package com.qupai.controller.auction;

import com.qupai.domain.entity.Auction;
import com.qupai.domain.result.Result;
import com.qupai.domain.vo.AuctionEndVO;
import com.qupai.service.IAuctionService;
import com.qupai.service.IHostService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/auction/host")
@Tag(name = "主持拍卖会相关接口")
public class HostController {

    @Resource
    private IHostService hostService;

    @Operation(summary = "根据拍卖会id开始拍卖会")
    @PostMapping("/start/{auctionId}")
    public Result<Auction> start(@PathVariable Long auctionId){
        return Result.success(hostService.start(auctionId));
    }

    @Operation(summary = "根据拍卖会id结束拍卖会")
    @PostMapping("/end/{auctionId}")
    public Result<AuctionEndVO> end(@PathVariable Long auctionId){
        return Result.success(hostService.end(auctionId));
    }

    //TODO websocket
}
